<?php
/**
 * 重复的加上地区显示
 */
require_once '../../../common.inc.php';
require_once 'fun.php';
$mysqli = new mysqli('localhost', 'root', '', 'test_data');

$sql = 'select py_lower from koubei_myisam2  group by py_lower having count(py_lower) > 1';
$result = $mysqli->query($sql);
$sames = $result->fetch_all();
$sames = var_export($sames, true);
echo $sames;exit();
include 'du.array.php';
$start = isset($start) ? $start : 0;
$handle = $du[$start][0];
$sql = "select py_lower, chengshi, id from koubei_myisam2 where py_lower = '{$handle}'";
//var_dump($sql);
//exit();
$result = $mysqli->query($sql);
$res = $result->fetch_all(MYSQLI_ASSOC);
$num = 1;
foreach ($res as $r) {
	$new = $r['py_lower'].'_'.$num;
	$num++;
	$sql = "update koubei_myisam2 set py_lower ='{$new}' WHERE ID = {$r['id']}";

//	 exit(var_dump($sql));
	$mysqli->query($sql);
}

$start +=1;
echo '<meta http-equiv="refresh" content="0; url='.$_SERVER['PHP_SELF'].'?start='.$start.'" />';
echo '<pre style="font-size:100px;">';
echo $du[$start-1][0] .'-'. $handle .'-' . (number_format(($start/count($du))*100, 2)).'%';
echo '</pre>';
exit();

?>
